<div id="contextModuleMenu" class="easyui-menu" style="width:200px;">
    <?php
    sort($modules);
    foreach ($modules as $key => $value) {
        if($value['name'] == 'pages'){
            continue;
        }
        ?>
        <div data-options="iconCls:'icon-<?php echo $this->Html->getModuleIcon($value['name']); ?>', href:'<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => 'dataGrid')); ?>'">  
            <span><?php echo $value['name']; ?></span>
            <div style="width:250px;">
                <div data-options="iconCls:'icon-application-form', href:'<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => 'index')); ?>'"><?php echo __('Cake Form'); ?></div>
                <div data-options="iconCls:'icon-table--arrow', href:'<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => 'dataGrid')); ?>'"><?php echo __('Data Grid'); ?></div>
                <?php
                foreach ($value['blocks'] as $key2 => $value2) {
                    ?>
                    <div data-options="iconCls:'icon-<?php echo $this->Html->getBlockIcon($value['name'], $value2); ?>', href:'<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => $value2)); ?>'"><?php echo ucwords(str_replace(array("block_", "_"), array("", " "), $value2)); ?></div>
                    <?php
                }
                ?>
            </div>
        </div>  
        <?php
    }
    ?>
</div>  
<script>
    $(function() {
        $('#contextModuleMenu').menu();
        $(document).bind('contextmenu', function(e) {
            e.preventDefault();
            $('#contextModuleMenu').menu('show', {
                left: e.pageX,
                top: e.pageY
            });
        });
    });
</script>
